package exception;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class TestReadFile {
    public static void main(String[] args)  {
        FileReader read = null;
        try{
             read = new FileReader("D:/gitrepo/java_demo/demo2/src/IO/abc.txt");//读取一个文件
             char c1 =(char) read.read();//读取一个字符
            System.out.println(c1);
        }catch (FileNotFoundException e){
            e.printStackTrace();
        }catch (IOException e){
            e.printStackTrace();
        }finally {
            //关闭读取
            try {
                    if(read!=null) {
                        read.close();
                    }
            }catch (IOException e) {
                e.printStackTrace();
            }

        }
    }
}
